<?php

class Base_nginx_log extends Base_fetch {

	private $_date;
	private $_log_path;

	function __construct() {
		$this->_date = date('Ymd', time());
		$this->_log_path = "/var/log/nginx/access.log-{$this->_date}.gz";
		// $this->_log_path = "/var/log/nginx/access.log-20150108.gz";
	}

	public function grep($grep_cmd) {
		return trim(shell_exec("gzip -dc {$this->_log_path} | {$grep_cmd} | wc -l"));
	}

}